<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddTargetAmountToCrowdfundingProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('crowdfunding_products', function (Blueprint $table) {
            $table->decimal('target_amount',10,2)->unsigned()->comment('众筹金额')->after('product_id');
            $table->decimal('total_amount',10,2)->default(0)->comment('目标金额')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('crowdfunding_products', function (Blueprint $table) {
            $table->dropColumn('target_amount');
            $table->decimal('total_amount',10,2)->comment('目标金额')->change();
        });
    }
}
